home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / v20timer.zip / V20TIMER.ASM < prev    next >
Assembly Source File  |  1985-11-02  |  7KB  |  191 lines

  1. ;
  2. ;
  3. ;                            V20TIMER.ASM
  4. ;
  5. ;    Adapted from "ptimer.asm/cpu.com"
  6. ;
  7. ;    Modified 851028 by COMPUQUEST Inc. to show full, accurate clock speed.
  8. ;
  9. ;    
  10. ;    This timing loop is constructed to take exactly 10.0 seconds to
  11. ;    execute when run on a standard pc/compatible using the 8088 micro
  12. ;    and the standard clock speed of 4.77 Mhz.
  13. ;
  14. ;    The speed gain achieved by using the NEC V20, as can be seen, is
  15. ;    almost 300%.  It should be noted that the V20 gets its advantage
  16. ;    mainly from its ability to execute instructions in a fraction of
  17. ;    the normal bus-cycle time taken to do the same instruction with
  18. ;    an 8088.  Therefore, this timing test shows a greater improvement
  19. ;    than you would see with normal PC use.
  20. ;
  21. ;    Still... a V20 in your PC will make a BIG DIFFERENCE in speed for
  22. ;    things like spreadsheet recalcs, assemblies, compiles, and other
  23. ;    tasks where alot of memory moves, calculation instructions etc. are
  24. ;    going on.   
  25. ;
  26. ;    As a good example, that %$*&#@$ wait needed to run the Memory Check
  27. ;    when you boot a PC will take only about 1/4 the time !!
  28. ;
  29. ;
  30. ;        NOTE:  COMPUQUEST Inc. is an electronic engineering Co.
  31. ;               that designs and develops microprocessor-based    
  32. ;               products; both hardware and software.  If you need
  33. ;               more info, give us a call !!
  34. ;
  35. ;   SPEED UP YOUR PC/COMPATIBLE FOR JUST $19.95 with NEC V20-8!
  36. ;Only $19.95 from COMPUQUEST Inc. !   In Stock, Same-day Shipment !
  37. ;Includes installation instructions.  This is an 8 Mhz part!
  38. ;NEC V20-8 is a direct replacement for 8088 CPU.  Just plug in and go.
  39. ;Complete compatibility with 8087. Uses only 20% of the power that
  40. ;the 8088 draws, and makes your PC run up to 90%  --- -- ->FASTER!!
  41. ;Use your Master Charge, VISA, AMEX, COD or Check.
  42. ;Delivery in Illinois, add 7% tax. ($1.40)
  43. ;Call, write, or pick up Monday - Friday  8:00 / 5:00 at
  44. ; COMPUQUEST Inc.  801 Morse Ave.  Schaumburg, IL  60193    
  45. ;           1-800-722-2353 Outside Illinois
  46. ;           (312) 529-2552 Inside  Illinois or for 
  47. ;                          Nationwide Technical Info
  48. ;     NOTE: V30-8 (replaces 8086) also available at $24.95 ea.
  49. ;
  50. ; Full specification booklet and application notes are available for $5.00
  51. ;
  52. ;
  53. ;
  54. ;
  55. ;
  56. ;
  57. ;
  58. ;
  59. LF      EQU     0AH
  60. CR      EQU     0DH
  61.  
  62. code    SEGMENT
  63.         ASSUME  CS:code,DS:code,ES:code
  64.         ORG     100H
  65. start:  MOV     AH,9
  66.         MOV     DX,OFFSET banner
  67.         INT     21H
  68.         MOV     AH,2CH
  69.         INT     21H
  70. ;                                     clocks needed
  71. ;--------------------------------------------------
  72.         MOV  OldSec,DX ; 19              =       19
  73.         XOR  AX,AX     ;  3              =        3
  74.         MOV  DX,10     ;  4              =        4 
  75. outer:  MOV  CX,47227  ;  4         * 10 =       40
  76. inner:  AAM            ; 83 * 47227 * 10 = 39198410   (  1.98 % )
  77.         DEC  CX        ;  2 * 47227 * 10 =   944540   (  1.98 % )
  78.         JNZ  inner     ; 16 * 47226 * 10 +  
  79.                        ;  4         * 10 =  7556200   ( 15.84 % )
  80.         DEC  DX        ;  2         * 10 =       20
  81.         JNZ  outer     ; 16         *  9 +  
  82.                        ;  4              =      148
  83.         MOV  AH,2CH    ;  4              =        4
  84.         INT     21H
  85. ;--------------------------------------------------
  86. ;                        T O T A L       = 47699388 + INT GetTime
  87. ;                        or                4.77E+06 * 10
  88.  
  89. ;
  90. ; If NEC V-20 is plugged into the PC, with no other changes, (i.e. still 
  91. ; running 4.77 Mhz), the faster instruction execution time of the NEC V-20 
  92. ; greatly reduces the routine execution time to only 15980000 clocks 
  93. ; instead of 47699388.  Thus:
  94. ;
  95. ;   "Actual execution time here was 03.35 seconds
  96. ;    Effective clock speed = 14.23 Mhz" 
  97. ;
  98. ;
  99. ;
  100.         MOV     AX,100
  101.         IMUL    DH
  102.         MOV     DH,0
  103.         ADD     AX,DX                  ;seconds(after)  * 100  [0..5999]
  104.         MOV     BX,AX
  105.         MOV     DX,OldSec
  106.         MOV     AX,100
  107.         IMUL    DH
  108.         MOV     DH,0
  109.         ADD     AX,DX                  ;seconds(before) * 100  [0..5999]
  110.         SUB     BX,AX
  111.         JNB     SameM                  ;within same minute, no adjustment
  112.         ADD     BX,6000                ;otherwise add 1 minute
  113. SameM:  MOV     AX,BX
  114.         MOV     DifSec,BX
  115.         MOV     BP,offset ACTsec
  116.         MOV     BX,1000
  117.         CWD
  118.         IDIV    BX                     ;dx:ax / 1000
  119.         CALL    ToASC                  ;get first digit
  120.         MOV     BX,100
  121.         MOV     AX,DX
  122.         CWD
  123.         IDIV    BX
  124.         CALL    ToASC                  ;get second digit
  125.         INC     BP                     ;skip decimal point
  126.         MOV     BX,10
  127.         MOV     AX,DX
  128.         CWD
  129. EX:     IDIV    BX   
  130.         CALL    ToASC                  ;first digit after decimal point
  131.         MOV     AX,DX
  132.         CALL    ToASC                  ;last digit after decimal point
  133.         MOV     AH,9
  134.         MOV     DX,OFFSET EXCmsg
  135.         INT     21H
  136.         MOV     AX,4770
  137.         CWD
  138.         MOV     BX,DifSec
  139.         DIV     BX
  140.         MOV     BP,offset EFFclk
  141. ;
  142. ;    PROVIDE FOR TWO DIGITS BEFORE DECIMAL PT.
  143.     DIV    TEN        ;REDUCE AX TO QUOTIENT, REMAINDER
  144.     CALL    ToASC        ;PROCESS QUOTIENT INTO TENS DIGIT
  145.     XCHG    AL,AH        ;PUT REMAINDER INTO AL
  146. ;
  147.     CALL    ToASC                  ;get one digit
  148.         INC     BP                     ;skip decimal point
  149.         MOV     AX,DX
  150.         MOV     CX,10
  151.         MUL     CX                     ;remainder * 10
  152.         DIV     BX
  153.         CALL    ToASC
  154.         MOV     AX,DX
  155.         MUL     CX                     ;remainder * 10
  156.         DIV     BX
  157.         CALL    ToASC
  158.         MOV     AH,9
  159.         MOV     DX,OFFSET EFFmsg
  160.         INT     21H
  161.         MOV     AH,4CH                 ;terminate with '$'
  162.         INT     21H                    ;as return code
  163.  
  164. ToASC   proc    near
  165.         OR      AL,30H
  166.         MOV     [BP],AL
  167.         INC     BP
  168.         ret
  169. ToASC   endp
  170.  
  171. OldSec  DW      0
  172. DifSec  DW      0
  173. Ten    db    0ah
  174.  
  175. Banner  DB      '        EXECUTION TIME vs. CLOCK SPEED  (minimal RAM access),   please wait...'
  176.         DB      CR,LF,'$'
  177. EXCmsg  DB      'Execution time should be 10.00 secs if 4.77 Mhz clock'
  178.         DB      ' & no WAITs on RAM access',CR,LF,CR,LF,CR,LF,CR,LF,CR,LF
  179.         DB      'Actual execution time here was '
  180. ACTsec  DB      '00.00 seconds',CR,LF,'$'
  181. EFFmsg  DB      'Effective clock speed = '
  182. EFFclk  DB      '00.00 Mhz',CR,LF,'$'
  183.  
  184. code    ENDS
  185. ;
  186.         END   start
  187.